/* AUTHOR OF SERIALAPI.h -> KILLIAN MURPHY */

/* GUARD */
#ifndef __SERIALAPI_H__
#define __SERIALAPI_H__

/* INCLUSIONS */
#include "debug_frmwrk.h"
#include "LPC17xx.h"
#include "lpc17xx_gpio.h"
#include "lpc17xx_pinsel.h"
#include "lpc17xx_uart.h"
#include <stdlib.h>

#include "LINEFOLLOW.h"
/* DEFINITIONS */
#define M1FBYTE 0xC1 // CONTROL BYTE USED TO ENGAGE MOTOR 1 FORWARDS;
#define M1RBYTE 0xC2 // CONTROL BYTE USED TO ENGAGE MOTOR 1 IN REVERSE;
#define M2FBYTE 0xC5 // CONTROL BYTE USED TO ENGAGE MOTOR 2 FORWARDS;
#define M2RBYTE 0xC6 // CONTROL BYTE USED TO ENGAGE MOTOR 2 IN REVERSE;

/* FUNCTION PROTOTYPES */
void SERIAL_INIT(void); // CONFIGURE UART;STOP LINE-FOLLOWING; 
                        // SET MOTOR SPEEDS TO 0; INIIALISE TIMER0;

void MOVE_FORWARD(uint8_t SPEED); // ENGAGE BOTH MOTORS FORWARD WITH $SPEED;
void MOVE_REVERSE(uint8_t SPEED); // ENGAGE BOTH MOTORS IN REVERSE WITH $SPEED;
void STOP_MOTORS(void); // DISENGAGE BOTH MOTORS;

void M1_STOP(void); // DISENGAGE MOTOR 1;
void M2_STOP(void); // DISENGAGE MOTOR 2;

void M1_FORWARD(uint8_t SPEED); // SET MOTOR 1 TO ENGAGE FORWARDS WITH $SPEED;
void M1_REVERSE(uint8_t SPEED); // SET MOTOR 1 TO ENGAGE IN REVERSE WITH $SPEED;
void M2_FORWARD(uint8_t SPEED); // SET MOTOR 2 TO ENGAGE FORWARD WITH $SPEED;
void M2_REVERSE(uint8_t SPEED); // SET MOTOR 2 TO ENGAGE IN REVERSE WITH $SPEED;

void M1_INCREASE(uint8_t SPEED); // INCREASE THE SPEED OF MOTOR 1 BY $SPEED;
void M1_DECREASE(uint8_t SPEED); // DECREASE THE SPEED OF MOTOR 1 BY $SPEED;
void M2_INCREASE(uint8_t SPEED); // INCREASE THE SPEED OF MOTOR 2 BY $SPEED;
void M2_DECREASE(uint8_t SPEED); // DECREASE THE SPEED OF MOTOR 2 BY $SPEED;

/*void ROTATE_CLKW   (uint32_t DEGREES); // ROTATE, IN A CLKWISE DIRECTION, $DEGREES;
void ROTATE_CCLKW  (uint32_t DEGREES); // ROTATE, IN A CCLKWISE DIRECTION, $DEGREES;

void TIMER0_IRQHandler (void); // INTERRUPT SERVICE ROUTINE FOR TIMER0, USED IN ROTATION; */

#endif
